﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;

namespace StructuredProgrammingAssignment.Models.Configurations
{
	public class SensitiveLogParamCollection : ConfigurationElementCollection
	{
		public SensitiveLogParamElement this[int index] {
			get {
				return base.BaseGet(index) as SensitiveLogParamElement;
			}
			set {
				if (base.BaseGet(index) != null) {
					base.BaseRemoveAt(index);
				}
				this.BaseAdd(index, value);
			}
		}

		protected override ConfigurationElement CreateNewElement() {
			return new SensitiveLogParamElement();
		}

		protected override object GetElementKey(ConfigurationElement element) {
			return ((SensitiveLogParamElement)element).Value;
		}

		public List<string> ValueList() {
			List<string> result = new List<string>();

			for (int i = 0; i < this.Count; i++) {
				result.Add(this[i].Value);
			}

			return result;
		}
	}
}